package com.zb.jsp.service.active;

import java.util.List;

import com.zb.jsp.dao.active.AdvertInfoDao;
import com.zb.jsp.vo.advert.AdvertVo;

public class AdvertInfoService {

	AdvertInfoDao advertInfoDao = new AdvertInfoDao();
	
	/**	
	 * 查询广告名和广告id
	 * @return advertVoList 传回广告id和广告名
	 */
	public List<AdvertVo> findAdvertInfoList() {
		List<AdvertVo> advertVoList = null;
		//用来查询广告类型的hql文
		String hql = "select new com.zb.jsp.vo.advert.AdvertVo(id,advertName) from TblAdvert";
		return advertInfoDao.findAdvertInfoList(hql);
	}
	
	/**	
	 * 查询未参加活动的广告名和广告id
	 * @return advertVoList 传回未参加活动的广告id和广告名
	 */
	public List<AdvertVo> findAdvertInfoNotAttendAcctiveList(Integer id) {
		List<AdvertVo> advertVoList = null;
		//用来查询未参加活动的广告信息的hql文
		String hql = "select new com.zb.jsp.vo.advert.AdvertVo(id,advertName) from TblAdvert where id not in (select advertId from TblActiveAdvert where activeId = "+id+")";
		return advertInfoDao.findAdvertInfoList(hql);
	}
	
	/**	
	 * 查询参加活动的广告名和广告id
	 * @return advertVoList 传回参加活动的广告id和广告名
	 */
	public List<AdvertVo> findAdvertInfoAttendAcctiveList(Integer id) {
		List<AdvertVo> advertVoList = null;
		//用来查询未参加活动的广告信息的hql文
		String hql = "select new com.zb.jsp.vo.advert.AdvertVo(id,advertName) from TblAdvert where id in (select advertId from TblActiveAdvert where activeId = "+id+")";
		return advertInfoDao.findAdvertInfoList(hql);
	}
}
